package com.sy.department.web;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sy.department.dao.po.DepartmentPo;
import com.sy.department.utils.ResultUtils;
import com.sy.department.utils.ResultVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Tags(
        @Tag(name = "部门管理", description = "部门管理 API")
)
public interface IDepartmentController {

    @Operation(summary = "查询单个部门信息", description = "根据查询条件，查询符合条件的单个部门信息", method = "POST")
    public RespGetDepartment getDepartment(ReqQueryDepartment args);

    @Operation(summary = "查询全部部门信息", description = "根据查询条件，查询符合条件的全部部门信息", method = "POST")
    public RespListDepartment listDepartment(ReqQueryDepartment args);

    @Operation(summary = "分页查询部门信息", description = "根据查询条件，查询符合条件的全部部门信息，并分页显示", method = "POST")
    public RespPageDepartment pageDepartment(ReqQueryDepartment args);

    @PostMapping("/put")
    public RespAddDepartment addDepartment(@RequestBody DepartmentPo po);

    @PostMapping("/post")
    public RespUpdateDepartment updateDepartment(@RequestBody DepartmentPo po);

    @PostMapping("/delete")
    public RespDeleteDepartment deleteDepartment(@RequestBody DepartmentPo po);

    @Data
    public static class ReqQueryDepartment {
        private Long Id;
        private String Name;
        private String location;
        private Long currentPage;
        private Long pageSize;
    }

    class RespGetDepartment extends ResultVo<DepartmentPo> {
        public RespGetDepartment(DepartmentPo data) {
            super("查询成功", 200, data);
        }
    }

    class RespListDepartment extends ResultVo<List<DepartmentPo>> {
        public RespListDepartment(List<DepartmentPo> list) {
            super("查询成功", 200, list);
        }
    }

    class RespPageDepartment extends ResultVo<Page<DepartmentPo>> {
        public RespPageDepartment(Page<DepartmentPo> page) {
            super("查询成功", 200, page);
        }
    }

    class RespAddDepartment extends ResultVo<Void> {
        public RespAddDepartment() {
            super("添加成功", 200, null);
        }
    }

    class RespUpdateDepartment extends ResultVo<Void> {
        public RespUpdateDepartment() {
            super("更新成功", 200, null);
        }
    }

    class RespDeleteDepartment extends ResultVo<Void> {
        public RespDeleteDepartment() {
            super("删除成功", 200, null);
        }
    }


}
